package com.cn.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.cn.service.CostService;
import com.cn.service.HelloService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author jiangwang
 * @Created by 2020/9/5 11:11
 * @Description: TODO
 */
@RestController
public class HelloController
{
    @Reference
    private HelloService helloService;

    @Reference
    private CostService costService;

    @RequestMapping(value = "/hello")
    public String hello()
    {
        String hello = helloService.sayHello("world");
        System.out.println(helloService.sayHello("BJQ"));
        return hello;
    }

    @GetMapping(value = "/add")
    public String getCost(int a)
    {
        return "共消费了：" + costService.add(a);
    }


}
